package com.cx.tran2.service.impl;

import com.cx.annotation.TxTans;
import com.cx.domain.TransVO;
import com.cx.tran2.mapper.Trans2Mapper;
import com.cx.tran2.service.Tran2Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class Tran2ServiceImpl implements Tran2Service {
    @Autowired
    private Trans2Mapper trans2Mapper;

    @Override
    @TxTans
    public String addTest2(String p){
        TransVO vo = new TransVO();
        vo.setStr(p+"tran2");
        trans2Mapper.addRecord2(vo);

        return "okadd2";
    }

    @Override
    public String updateTest2(String p, Long id){
        TransVO vo = new TransVO();
        vo.setId(id.intValue());
        vo.setStr(p);
        trans2Mapper.updateRecord2(vo);
        return "opupdate2";
    }
}
